//
//  NSString+Dir.m
//  XML
//
//  Created by 庄猛 on 15/12/31.
//  Copyright © 2015年 庄猛. All rights reserved.
////

#import "NSString+Dir.h"

@implementation NSString (Dir)
+(NSString *)homeDir{
    return NSHomeDirectory();
}


-(NSString *)docDir{

    //参数1.要搜索的路径  2.在当前用户中搜索  3.展开全路径
    NSString *dir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    return [dir stringByAppendingPathComponent:[self lastPathComponent]];
}


-(NSString *)tmpDir{

    NSString *dir = NSTemporaryDirectory();
    return [dir stringByAppendingPathComponent:[self lastPathComponent]];
}



-(NSString *)cachesDir{

    NSString *dir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)lastObject];
    return [dir stringByAppendingPathComponent:[self lastPathComponent]];
}

+(NSString *)preferencesDir{
    // NSUserDefaults *userDefaults =  [NSUserDefaults standardUserDefaults];
    return @"用户偏好设置直接获取";
}


@end
